package com.yunao.web.controller;

import com.yunao.commons.utils.JsonUtil;
import com.yunao.commons.utils.ResultVOUtil;
import com.yunao.commons.vo.ResultVO;
import com.yunao.service.TradeService;

import com.yunao.web.annotation.UserLoginToken;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;

@RestController
public class TradeController {

    @Autowired
    private TradeService tradeService;

    @Autowired
    private StringRedisTemplate stringRedisTemplate;
    @UserLoginToken
    @RequestMapping("/user/trademap")
    @Cacheable(cacheNames = "position",key = "1234")
    public ResultVO getTrade(){
        List<Map> trades = tradeService.findAll();
        return ResultVOUtil.success(trades);
    }
}
